DROP TABLE S004.S004_T08402 CASCADE CONSTRAINTS;

CREATE TABLE S004.S004_T08402
(
  SEQ_NO            NUMBER,
  MANUAL_CODE       NUMBER,
  CHAPTER_CODE      NUMBER,
  SECTION_CODE      NUMBER,
  SECTION_TITLE     VARCHAR2(1000 BYTE),
  SECTION_SUMMARY   VARCHAR2(4000 BYTE),
  PAGE_NO           VARCHAR2(20 BYTE),
  PAGE_CONTENT      BLOB,
  AMMENDMENT        CHAR(1 BYTE),
  EFFECTIVITY_DATE  DATE,
  REMARKS           VARCHAR2(4000 BYTE),
  CREATED_BY        VARCHAR2(100 BYTE),
  DATE_CREATED      DATE,
  MODIFIED_BY       VARCHAR2(100 BYTE),
  DATE_MODIFIED     DATE
)
TABLESPACE HRIS
PCTUSED    0
PCTFREE    10
INITRANS   1
MAXTRANS   255
STORAGE    (
            INITIAL          64K
            NEXT             1M
            MINEXTENTS       1
            MAXEXTENTS       UNLIMITED
            PCTINCREASE      0
            BUFFER_POOL      DEFAULT
           )
LOGGING 
NOCOMPRESS 
LOB (PAGE_CONTENT) STORE AS 
      ( TABLESPACE  HRIS 
        ENABLE      STORAGE IN ROW
        CHUNK       8192
        RETENTION
        NOCACHE
        INDEX       (
          TABLESPACE HRIS
          STORAGE    (
                      INITIAL          64K
                      NEXT             1
                      MINEXTENTS       1
                      MAXEXTENTS       UNLIMITED
                      PCTINCREASE      0
                      BUFFER_POOL      DEFAULT
                     ))
        STORAGE    (
                    INITIAL          64K
                    NEXT             1M
                    MINEXTENTS       1
                    MAXEXTENTS       UNLIMITED
                    PCTINCREASE      0
                    BUFFER_POOL      DEFAULT
                   )
      )
NOCACHE
NOPARALLEL
MONITORING;

COMMENT ON TABLE S004.S004_T08402 IS 'Maintenance Table for Section Details';


CREATE OR REPLACE TRIGGER S004."S004_T08402_BI001" 
before insert or update or delete
 ON S004.S004_T08402 for each row
begin
   if inserting then
      if :new.seq_no is null then
         select s004_t08402_sq001.nextval
         into :new.seq_no 
         from dual;
      end if; 
     :new.created_by    := user;
     :new.date_created  := sysdate;
   elsif updating then
     :new.modified_by   := user;
     :new.date_modified := sysdate;
   end if;
end;
/


